package com.tensquare.qa.dao;

import com.tensquare.qa.pojo.Problem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by WF on 2020/7/22 15:48
 */
public interface ProblemDao extends JpaRepository<Problem,String>, JpaSpecificationExecutor<Problem> {

    //1.查询最新问题列表
    @Query(nativeQuery=true,value="select * from tb_problem p,tb_pl pl where id=problemid and labelId=?1 order by createtime desc")
    Page<Problem> findProblemsByLabelId(String labelId, Pageable pageable);
    //2.查询热门问题列表
    @Query(nativeQuery=true,value="select * from tb_problem p,tb_pl pl where id=problemid and labelId=?1 order by reply desc")
    Page<Problem> findHostList(String lableId,Pageable pageable);
}
